<?php
    use yii\helpers\Html;
    use yii\helpers\Url;
    use yii\widgets\LinkPager;
    use backend\utils\ImageSize;
?>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">

            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>首页轮播图列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="form-group form-horizontal form-style">
                        <?php if($this->context->isAuth('web/sliders-image-add')){?><a class="btn btn-primary" href="<?= yii\helpers\Url::to(['sliders-image-add'])?>">添加</a><?php }?>
                    </div>
                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <tr class="tb-title">
                            <th class="text-center">ID</th>
                            <th class="text-center">标题</th>
                            <th class="text-center">图片</th>
                            <th class="text-center">排序</th>
                            <th class="text-center">创建时间</th>
                            <th class="text-center">操作</th>
                        </tr>
                        <?php if(!empty($list)) foreach($list as $val){ ?>
                        <tr align="center" data-id="<?= $val->id?>">
                            <td><?= $val->id ?></td>
                            <td><a href="<?= $val->url ?>" target="_blank" ><?= Html::encode($val->title) ?></a></td>
                            <td><a href="<?=ImageSize::image(['url'=>$val->image])?>" target="_blank" title="点击查看大图"><img src="<?=ImageSize::image(['url'=>$val->image,'width'=>216,'high'=>80])?>"/></a></td>
                            <td><input class="edit_sort" data-model="SlidersImageModel" data-id="<?= $val->id?>" type="text" value="<?= $val->sort ?>"</td>
                            <td><?= date('Y-m-d',$val->create_time) ?></td>
                            <td>
                                <?php if($this->context->isAuth('web/sliders-image-edit')){?><a class="btn btn-xs btn-primary" href="<?=Url::to(['sliders-image-edit','id'=>$val->id])?>">编辑</a>&nbsp;&nbsp;<?php }?>
                                <?php if($this->context->isAuth('web/sliders-image-dele-ajax-do')){?><a href="javascript:;" class="btn btn-xs btn-warning ajax_action" tip="删除" url="sliders-image-dele-ajax-do">删除</a><?php }?>
                            </td>
                        </tr>
                        <?php }?>
                    </table>
                    <?php
                        echo LinkPager::widget([
                            'pagination' => $pagination,
                        ]);
                    ?>
                </div>
            </div>
        </div>
    </div>